<?php
class Userlist extends Service {
	
	/**
	 * 默認method
	 * @param array $param
	 */
	public function run($param = ''){}
	
	public function lists($param = ''){
		$_return = array();
		$pdo = ZKF::model('Zpdo');
		$page_size = 2;
		$page = isset($param['page'])?intval($param['page']):1;
		//$pdo->table('user')->where('id=3')->del();
		//echo $pdo->sql();
		$_return['users'] = $pdo->table('user as a')->field('a.id,a.username')->where('a.user_type=1')->page($page,$page_size)->fetchHash();
		//echo $pdo->sql();
		$_pageinfo = $pdo->pageinfo();
		//$_return['users2'] = $user->table('user')->field('id,username,photo')->fetch();
		//$_page = $user->getPage();
		//$data_total = $user->table('user')->set(array('field'=>'id','where'=>'user_type=1'))->count();
		
		
		ZKF::import("Page");
		$_return['pagelist'] = Page::show($_pageinfo['page'],$_pageinfo['total'],$_pageinfo['size'],'userlist.php');
		//ZKF::dump($_return);
		return $_return;
	}
	public function lists2($param = ''){
		$_return = array();
		$pdo = ZKF::model('Zpdo');
		$page_size = 5;
		$page = isset($param['page'])?intval($param['page']):1;
		//$pdo->table('user')->where('id=3')->del();
		//echo $pdo->sql();
		$_return['users'] = $pdo->table('user as a')->field('a.id,a.username')->where('a.user_type=1')->page($page,$page_size)->fetchHash();
		//echo $pdo->sql();
		$_pageinfo = $pdo->pageinfo();
		//$_return['users2'] = $user->table('user')->field('id,username,photo')->fetch();
		//$_page = $user->getPage();
		//$data_total = $user->table('user')->set(array('field'=>'id','where'=>'user_type=1'))->count();
		
		
		ZKF::import("Page");
		$_return['pagelist'] = Page::show($_pageinfo['page'],$_pageinfo['total'],$_pageinfo['size'],'userlist.php');
		//ZKF::dump($_return);
		return $_return;
	}
}
?>